﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common;
using IBll.Sys;
using Model.Sys;

namespace Bll.Sys
{
    public class MemoryCacheBll:ICacheBll
    {
        public bool Add(string key, object value)
        {
            return MemoryCacheHelper.AddCache(key, value);
        }

        public bool Add(string key, object value, DateTime expireTime)
        {
            return MemoryCacheHelper.AddCache(key, value, expireTime);
        }

        public bool Remove(string key)
        {
            return MemoryCacheHelper.RemoveCache(key);
        }

        public bool Remove(List<string> keys)
        {
            foreach (var key in keys)
            {
                MemoryCacheHelper.RemoveCache(key);
            }
            return true;
        }

        public bool Remove()
        {
            return MemoryCacheHelper.RemoveCache();
        }

        public bool Update(string key, object value)
        {
            return MemoryCacheHelper.UpdateCache(key, value);
        }

        public int GetCount()
        {
            return MemoryCacheHelper.GetCacheCount();
        }

        public bool IsExists(string key)
        {
            return MemoryCacheHelper.IsExistCache(key);
        }

        public Cache GetCache(string key)
        {
            return MemoryCacheHelper.GetCache(key);
        }
    }
}
